package org.hot100_0.leetcode189;

public class Solution {
    public static void main(String[] args) {
        int [] item ={1,2,3,4,5,6,7};
        rotate(item,3);
    }
    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        int [] temp = new int[n];

        for (int i = 0; i < n; i++) {
            int newIndex =(i+k) % n ;
            temp[newIndex] = nums[i];
        }

        System.arraycopy(temp,0,nums,0,n);
    }
}
